﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using Facade;
using IronOne.SalesOne.BusinessObjects;


namespace IronOne.SalesOne.SalesOneWeb.ProductLibrary
{
    public partial class SearchManageBenefit : System.Web.UI.Page
    {
        List<QuoLifeBenefit> benefits;
        BenefitFacade benefitFacade = new BenefitFacade();


        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void ddlBenefitCode_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

            benefitFacade = new BenefitFacade();
            //int[] hideColumn = { 1 };
            int[] hideColumn = { 0, 1, 2 };

            String benefitName = ddlBenefitCode.SelectedValue;

           

            switch (benefitName)
            {
                case "ABFPB":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;
                case "ADB":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "ATPDA":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");
                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "ATPDS":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;
                case "BAS13":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "BASIC":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");
                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "BFPB":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;
                case "CMM":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");

                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "CMMH":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");
                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                case "CPDB":
                    benefits = benefitFacade.GetBenefits("CodeId ASC");
                    UCGrid1.SetDataSource(benefits, hideColumn);
                    UCGridButtons1.Visible = true;
                    UCGridButtons1.Visible = true;

                    break;

                //case "Select...":
                //    Response.Redirect("~/UserManagement/CodeType.aspx", false);
                //    //Server.Transfer("~/UserManagement/CodeType.aspx");
                //    break;

                default:
                    break;

            }



        }
    }
}
